$.fn.serializeObject = function(callback){
   var o = {};
   var a = this.serializeArray();
   for(var i=0; i < a.length; i++){
		var obj = a[i];
		var inputs = $("[name='"+obj.name+"']");
		if(obj.value.length == 0){
			if(inputs.attr("required") == "required"){
				util.toast(inputs.attr("placeholder"));
				return ;
			}
		}else{
			if(inputs.attr("pattern") != undefined ){
				var reg=eval(inputs.attr("pattern"));
				if(!obj.value.match(reg)){
					inputs.val("").focus();
					util.toast(inputs.attr("title"));
					return ;
				}
			}
		}
		
   }

   $.each(a,function(){
		if(o[this.name]){
			if(!o[thisname].push){
				o[this.name] = [o[this.name]];
			}	
			o[this.name].push(this.value || null);
		}else{
			o[this.name] = this.value || null;
		}
   });
   
   if(typeof callback == "function"){
		callback(o);
   }else{
		return o;
   }
}